﻿using Microsoft.Office.Tools.Ribbon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop;

namespace ExcelColumnSplitter
{
    public partial class Ribbon1
    {
        private SplitNavigatorForm splitNavigatorForm = null;
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {

        }
        
        private void SplitNavigatorButton_Click(object sender, RibbonControlEventArgs e)
        {
            // if has opened, focus it
            if (splitNavigatorForm != null)
            {
                splitNavigatorForm.Focus();
                return;
            }
            splitNavigatorForm = new SplitNavigatorForm()
            {
                StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
            };
            splitNavigatorForm.FormClosed += (object sender2, System.Windows.Forms.FormClosedEventArgs e2) =>
            {
                splitNavigatorForm = null;
            };
            splitNavigatorForm.Show();
        }

        private void OfficialWebsiteButton_Click(object sender, RibbonControlEventArgs e)
        {
            // open official website
            System.Diagnostics.Process.Start("https://gitee.com/xyqlx/excel-column-splitter");
        }

        private void ShowIntroductionButton_Click(object sender, RibbonControlEventArgs e)
        {
            IntroductionFrom introductionFrom = new IntroductionFrom
            {
                StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
            };
            introductionFrom.Show();
        }

        private void PresetsButton_Click(object sender, RibbonControlEventArgs e)
        {
            PresetsForm presetsForm = new PresetsForm
            {
                StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
            };
            presetsForm.Show();
        }
    }
}
